package g3pd.gradep.virdgm;

public class VirdProcElem {
    String actionAttr;
    int [] inputPosAttr;
    int outputPosAttr = 0;
    int procID = 0;
    boolean done;
    
    VirdProcElem(String actionAttr, String outputPosAttr, String inputPosAttr, int procID) {
        this.inputPosAttr = new int[2];
        this.actionAttr = actionAttr;
        this.outputPosAttr = Integer.parseInt(outputPosAttr);
        parserInputPosAttr(inputPosAttr);
        this.procID = procID;
        this.done = false;
    }
    
    public boolean getDone() {
        return this.done;
    }
    
    public void setDone(boolean status) {
        this.done = status;
    }
    
    public String getActionAttr() {
        return actionAttr;
    }
    
    public void setActionAttr(String actionAttr) {
        this.actionAttr = actionAttr;
    }
    
    public int getOutputPosAttr() {
        return outputPosAttr;
    }
    
    public void setOutputPosAttr(int outputPosAttr) {
        this.outputPosAttr = outputPosAttr;
    }
    
    public int [] getInputPosAttr() {
        return inputPosAttr;
    }
    
    public void setInputPosAttr(int [] inputPosAttr) {
        this.inputPosAttr = inputPosAttr;
    }
        
    public int getProcID() {
        return procID;
    }
    
    public void setProcID(int procID) {
        this.procID = procID;
    }
    
    public void parserInputPosAttr(String InputPosAttr) {
        String inputPos1 = "";
        String inputPos2 = "";
        
        int c = 0;
        
        for(int i = 0; i < InputPosAttr.length(); i++) {
            if(InputPosAttr.charAt(i) == '(' || InputPosAttr.charAt(i) == ')');
            
            else if(InputPosAttr.charAt(i) == ',') {
                c = 1;
            }
            
            else if(c == 0) {
                inputPos1 = inputPos1 + InputPosAttr.charAt(i);
            }
            
            else if(c == 1) {
                inputPos2 = inputPos2 + InputPosAttr.charAt(i);
            }
        }
                
        this.inputPosAttr[0] = Integer.parseInt(inputPos1);
        this.inputPosAttr[1] = Integer.parseInt(inputPos2);        
    }
}